package com.example.luke.shengdangxiaoattendance.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.luke.shengdangxiaoattendance.Model.ClassBean;
import com.example.luke.shengdangxiaoattendance.R;

import java.util.ArrayList;

/**
 * Created by luke on 18/07/2017.
 */

public class ClassSelectionAdapter extends BaseAdapter{

    private ArrayList<ClassBean> classBeanArrayList;
    private LayoutInflater inflater;

 public    ClassSelectionAdapter(Context context,ArrayList<ClassBean>classBeanArrayList){

        inflater=LayoutInflater.from(context);

        this.classBeanArrayList=classBeanArrayList;

    }
    @Override
    public int getCount() {
        return classBeanArrayList.size();

    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        if (convertView==null)
            convertView=inflater.inflate(R.layout.class_row,null);


        ClassBean classBean=classBeanArrayList.get(position);
        TextView className=(TextView)convertView.findViewById(R.id.className);
        className.setText(classBean.className);

        return convertView;

    }

}